﻿using System;
using System.Collections.Generic; 
using System.Collections.Concurrent; 
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using BCGPSCommon;

namespace AppSocketControl.NOTUSE
{
    public  class UdpSendDeviceCmd
    {
        private UdpClient udpClient;
        private IPEndPoint iPEndPoint;

        public UdpSendDeviceCmd()
        {
            udpClient = new UdpClient();

        }

        public void SendCmd(string ip,int port,string msg)
        {

            try
            {
                iPEndPoint = new IPEndPoint(IPAddress.Parse(ip), port);

                byte[] sendBytes = Encoding.ASCII.GetBytes(msg);
                udpClient.Send(sendBytes, sendBytes.Length, iPEndPoint);

            }
            catch (System.Exception ex)
            {
                Msg.WirteLine(ex.Message);
            }
        }
    }
}
